package com.jyw.business.de.domain.dto.web;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.jyw.business.de.constant.ProjectStateConstant;
import com.jyw.business.de.domain.DeDemandAnalyze;
import com.jyw.business.de.domain.DeDemandProjectAudit;
import com.jyw.business.de.domain.DeDemandRating;
import com.jyw.common.annotation.Excel;
import com.jyw.common.utils.DateUtils;
import com.jyw.common.utils.SecurityUtils;
import com.jyw.common.utils.bean.BeanUtils;
import com.jyw.system.domain.vo.SimpleFileVo;
import com.jyw.system.utils.FileUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("需求定性请求实体")
public class DemandRatingAddDto {

    /** 需求主键 */
    @ApiModelProperty("需求主键")
    @NotNull(message = "需求id不能为空")
    private Long demandId;

    /** 定性类型(1 需求优化 2新建项目) */
    @ApiModelProperty("定性类型(1 需求优化 2新建项目)")
    @NotNull(message = "定性类型不能为空")
    private String ratingType;

    @ApiModelProperty("项目名称")
    private String projectName;

    /** 新建项目原因 */
    @ApiModelProperty("新建项目原因")
    private String projectRemark;

    /**
     * 审核id
     * @param auditId
     * @return
     */
    public DeDemandRating buildRating(Long auditId) {
        DeDemandRating rating = new DeDemandRating();
        BeanUtils.copyProperties(this,rating);
        rating.setCreateUser(SecurityUtils.getUserId());
        rating.setCreateTime(DateUtils.getNowDate());
        rating.setAuditId(auditId);
        return rating;
    }

    public DeDemandProjectAudit buildAudit() {
        DeDemandProjectAudit audit = new DeDemandProjectAudit();
        BeanUtils.copyProperties(this,audit);
        audit.setProjectState(ProjectStateConstant.WAIT_AUDIT);
        audit.setCreateUser(SecurityUtils.getUserId());
        audit.setCreateTime(DateUtils.getNowDate());
        return audit;
    }
}
